1. Field of the Invention
The invention relates to a process for switching MPEG streams, for example video sequences or program segments coded according to the MPEG standard, the acronym standing for the expression Motion Picture Expert Group.
2. Description of the Related Art
Films or video sequences are nowadays commonly stored in compressed form, so as to reduce the memory capacities required. Switchings of sequences are then performed not in baseband but directly on the basis of the MPEG coded data streams. Thus, successive video sequences are broadcast or one sequence is inserted into another sequence through the use of digital data stored in compressed form. A first stream of compressed video data corresponding to a first sequence of images, and referred to as the old stream, is followed, starting from a given point referred to as the switching point, by a second stream of compressed video data which is referred to as the new stream and corresponds to a second sequence of images.
The switching from one data stream coded according to the MPEG standard to another data stream coded according to this standard is beset with a number of problems in the area of the switching point.
Management of the buffer memory of the decoder is performed, in the MPEG standard, on the basis of modeling referred to as a virtual memory. Indeed, the coding of each image constituting a sequence is not carried out at constant cost and a buffer memory at the output of the coder is used to deliver a data stream at constant mean bit rate. On the decoder side, a buffer memory is also required so as to deliver, from the constant bit rate data stream, variable-cost images. Management of the buffer memory of the decoder is performed on the basis, among other things, of the clocks transmitted by the coder in the data stream and of the tags allocated to the images transmitted and defining the instant of exit from the memory of the decoder, the time gap between the instant of storage of an image in the memory of the coder and the instant of reading of the memory of the decoder having to be the same for each image.
This involves the PCR clock, standing for Program Clock Reference in the MPEG standard, which is a time cue transmitted in the data stream and on the basis of which the synchronization of the decoder is performed.
This also involves the DTS tag, standing for Decoding Time Stamp in the MPEG standard, which is a field transmitted in the stream and which indicates the instant at which an image is to be decoded in the decoder.
A first problem arises concerning the management of the memory of the decoder, owing to the fact that the number of bits per image (or frame) is not fixed. The state of the buffer memory varies over time and upon switching, the elements taken into account by the new stream for the management of this memory correspond to a state of fill of the memory which is different from the actual state corresponding to the old stream. This may result in saturation of the memory entailing image loss or a voiding of the memory creating a freeze-frame for example.
A second problem concerns the synchronization as regards the decoding and display of the images. The tags contained in the data streams relate to clocks specific to each stream (namely to a specific PCR) and the instants of decoding and display of the images need to be resynchronized.
Another problem is related to the very coding of the images. The various types of codings called upon by the MPEG standard are:
intra coding (I image) making reference to no preceding or following image,
inter coding of predictive type (P image) which may call upon a preceding reference image,
inter coding of bi-directional type (B image) which may call upon a preceding reference image and/or upon a following reference image.
The images are grouped together into a GOP or Group Of Pictures as it is called. The first of a GOP, when considering the order of transmission, is an image of intra type and the first few succeeding images of type B may call upon images of the same GOP, which is then a closed GOP, or else upon images of the same GOP and of the preceding GOP, which is then an open GOP.
The problem arises when the stream of data following the switching point begins with an open GOP. This is because the decoding of the compressed images of the first GOP of this second stream may require, if this is an open GOP, the utilization of images of the preceding GOP. The preceding GOP corresponding to a stream of data of another sequence, the decoded images corresponding to this open GOP will exhibit defects. These defects are generally highly visible and are due to the utilization, for the decoding of these first few images of type B of the second sequence, of a different reference image from that which was used for the coding. The image blocks constituting the image or the images of the open GOP which are coded in bi-directional mode are image blocks coded in inter mode on the basis of a P- or I-type reference image of the preceding GOP for the same image sequence. The decoding of the blocks coded in inter mode, blocks composed of residuals or of prediction errors, for the first few images of bi-directional type after the switching point, will utilize different blocks from those which served in calculating these inter-coded residuals blocks. The reference image taken into account at decoding level will in fact be an image of the old stream, and hence different from the image taken into account at coding level. Very annoying block effects consisting of the displaying of erroneous image blocks will therefore appear in the first few images of the second sequence.
A partial solution to these problems exists and is known to be described in the MPEG II standard (part 1: Systems, paragraph 2.4 and appendix K). This involves incorporating, within the system layer, information relating to possible switching points (referred to as xe2x80x9csplicing pointsxe2x80x9d in the standard) for which the transport stream has favorable characteristics, allowing decoding of the images without the defects cited above (for example by using closed GOPs). It will then be possible for switching to be performed at these points only. Of course, this information must be incorporated into the data stream right from the coding of the images and it is no longer possible to incorporate it thereafter other than by carrying out a new decompression and compression of the data.
A permitted switching point, at the start of a GOP, adds a constraint on the coding of the first few images of this GOP, which are coded in bi-directional mode, this GOP having to be closed. These images can no longer use, as reference images, preceding images but only succeeding images and they are therefore forced into monodirectional mode.
The use of closed GOPs, hence the coding of the first two B images following an I image on the basis of the following P image (order of coding) and of the one I image (instead of the preceding P image of the preceding GOP), it then being possible to regard these B images as P images, severs the regulating of the coder on the basis of the states of the buffer memory and hence degrades the quality of the images, on account of a higher coding cost. To give an order of magnitude, the images of P type have a coding cost which is about twice as high as that of the images of B type.
This MPEG II coding compatible with stream switchings is not ordinarily used for coding films or video sequences. There are at present very few products on the market which force closed GOPs for the requirements of switching, the constraints induced in respect of bit rate regulation at coder level being an annoyance. Moreover, a priori determination of whereabouts a closed GOP must exist in the data stream, that is to say prediction of whereabouts in the sequence the cuts will be, presupposes that one knows the future uses of the sequences. Otherwise, it would be necessary to produce closed GOPs exclusively, although one wishes to utilize only a very small number of them.
The drawbacks generated by this solution are therefore, among others:
lack of flexibility, the switchings being limited to predetermined switching points (or splice points),
reduction in the rate of compression of the video data due to the insertion of the switching points which have to be sufficiently numerous in the data stream as to allow a minimum flexibility, even though most of these points will not be utilized,
decoding and recoding required for the data streams which do not possess this stream switching compatibility at the outset, with all the problems related to re-storage, to image quality etc.,
risk of severe restrictions as regards bit rate regulation, perhaps going so far as a loss of image quality, if a large number of switching points is introduced.
The purpose of the present invention is to alleviate the aforesaid drawbacks.
It relates to a process for switching from an old MPEG data stream to a new MPEG data stream so as to obtain a switched stream, the point of exit in the old stream corresponding to the end of a data packet of a TS stream relating to the last image of the old stream and the point of entry in the new stream corresponding to the start of a data packet relating to the first image of the new stream, characterized in that,
PCRold (Program Clock Reference) and PCRnew being the clock instants relating respectively to the point of exit and point of entry, DTS_next_AUold (Decoding Time Stamp) and DTS_first_AUnew corresponding respectively to the calculated instant of decoding of the image following the last image of the old stream and the calculated instant of decoding of the first image of the new stream, if:
DTS_next_AUoldxe2x88x92PCRold less than DTS_first_AUnewxe2x88x92PCRnew,
then,
in a first step, the data of one or more last images of the old stream and/or one or more first images of the new stream are replaced by data of one or more new pre-encoded images of which the number is smaller so that the new value of PCRold and/or PCRnew thus obtained satisfies the relation:
DTS_next_AUoldxe2x88x92PCRoldxe2x89xa7DTS_first_AUnewxe2x88x92PCRnew,
in a second step, TS stuffing packets are inserted between the point of exit and the point of entry so as to make the decoding instants DTS_next_AUold and DTS_first_AUnew coincide.
It also relates to a process for switching from an old MPEG data stream to a new MPEG data stream so as to obtain a switched stream, the point of exit in the old stream corresponding to the end of a data packet of a TS stream relating to the last image of the old stream and the point of entry in the new stream corresponding to the start of a data packet relating to the first image of the new stream, characterized in that,
PCRold (Program Clock Reference) and PCRnew being the clock instants relating respectively to the point of exit and point of entry, DTS_next_AUold (Decoding Time Stamp) and DTS_first_AUnew corresponding respectively to the calculated instant of decoding of the image following the last image transmitted of the old stream and the calculated instant of decoding of the first image of the new stream, if:
DTS_next_AUoldxe2x88x92PCRold less than DTS_first_AUnewxe2x88x92PCRnew,
then,
in a first step, the instant of decoding DTS_first_AUnew of the first image of the new stream is modified to the value DTS_next_AUold plus n times the image period, n being equal to:
1+INT[((DTS_first_AUnewxe2x88x92PCRnew)xe2x88x92(DTS_next_AUoldxe2x88x92PCRold))/(image period)];
INT corresponding to the integer part,
in a second step, TS stuffing packets are inserted between the point of exit and the point of entry so as to make the decoding instants DTS_next_AUold and DTS_first_AUnew coincide modulo the image period.
According to a particular embodiment, the process is characterized in that the modification of the instant of decoding of the images of the new stream is performed by allocating a corresponding offset to the DTS tag and to the PCR clock for the new stream.
According to a particular embodiment, the process is characterized in that n pre-encoded images are inserted before the first image of the new stream, whose size and whose allocated tags allow their decoding during the DTS instants skipped by the first image of the new stream.
According to a particular embodiment, stuffing packets are inserted into the stream so as to make the instants of decoding of the images inserted correspond to the skipped DTS instants.
According to a particular embodiment, the cost of the replacement pre-encoded images in the new stream is such that the number of bits of the new stream entering the memory of the decoder between the instant PCRnew and the instant DTS_first_AUnewxe2x88x92(image period) is less than or equal to the number of bits of the old stream which would have been stored in the memory of the decoder between the instant PCRold and DTS_next_AUoldxe2x88x92(image period).
By virtue of the invention, a simple implementation of stream switching is possible, yielding, in baseband, a correct transition from one sequence to the other even though the MPEG data streams are not made compatible with such switchings by the addition of switching points. It is thus unnecessary to use high-cost equipment to carry out such switchings, for example, when inserting advertisements etc.
High flexibility and high quality of stream switching are obtained as regards the switching points.